import 'package:flutter/material.dart';
import 'package:zhongyiapp/pages/bookstore.dart';
import 'package:zhongyiapp/pages/example.dart';
import 'package:zhongyiapp/pages/index.dart';
import 'package:zhongyiapp/pages/user.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Consiliascreen(),
    );
  }
}

class Consiliascreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Color.fromARGB(255, 241, 239, 239),
        body: Column(children: const [
          doctor(),
          SizedBox(
            height: 23.0,
          ),
          Disease1(),
          SizedBox(
            height: 20.0,
          ),
          Disease2(),
          SizedBox(
            height: 20.0,
          ),
          Disease3(),
          SizedBox(
            height: 20.0,
          ),
          Disease4(),
          SizedBox(
            height: 25.0,
          ),
          Bar()
        ]));
  }
}

class doctor extends StatelessWidget {
  const doctor({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
        padding: EdgeInsets.only(top: 10.0),
        width: 450,
        height: 130,
        decoration: BoxDecoration(
            color: Color.fromARGB(255, 91, 86, 225),
            image: DecorationImage(
              image: AssetImage('assets/背景图4.jpg'),
              fit: BoxFit.cover,
              colorFilter: ColorFilter.mode(
                Colors.white.withOpacity(0.9), // 这里可以调整颜色和透明度
                BlendMode.dstATop, // 混合模式
              ),
            )),
        child: Column(children: <Widget>[
          ListTile(
            leading: GestureDetector(
              onTap: () {
                // 处理点击事件，跳转到其他页面
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => Indexscreen()));
              },
              child: Icon(
                Icons.arrow_back_ios,
                size: 25.0,
                color: Colors.white,
              ),
            ),
            title: Text(
              '医案',
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 25.0, color: Colors.white),
            ),
          ),
          Container(
            width: 350,
            height: 50,
            decoration: BoxDecoration(
                color: const Color.fromARGB(255, 240, 240, 240),
                borderRadius: BorderRadius.all(Radius.circular(16.0))),
            child: Row(
              children: [
                SizedBox(width: 8.0),
                Icon(Icons.search),
                SizedBox(width: 8),
                Expanded(
                  child: TextField(
                    decoration: InputDecoration(
                      hintText: '请输入疾病名称或关键字',
                      border: InputBorder.none,
                    ),
                    onSubmitted: (value) {
                      // 处理搜索逻辑
                      print('Search for: $value');
                    },
                  ),
                ),
              ],
            ),
          )
        ]));
  }
}

class Disease1 extends StatelessWidget {
  const Disease1({Key? key}) : super(key: key);

  void _onTap(BuildContext context) {
    Navigator.push(
        context, MaterialPageRoute(builder: (context) => Examplescreen()));
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => _onTap(context), // 添加点击事件处理函数
      child: Container(
        width: 380,
        height: 140,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16.0),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color.fromARGB(255, 249, 248, 248),
              blurRadius: 10.0,
              spreadRadius: 5.0,
              offset: Offset(5.0, 5.0),
            )
          ],
        ),
        padding: EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Text(
                  '颈椎病',
                  style: TextStyle(color: Colors.blue, fontSize: 20.0),
                ),
                SizedBox(
                  height: 8.0,
                ),
                Text(
                  '医师：胡希怒',
                  style: TextStyle(color: Colors.grey, fontSize: 20.0),
                ),
              ],
            ),
            Text('手臂麻木，肩痛，手颤抖，上肢无力，颈项活动不利',
                style: TextStyle(
                    color: Color.fromARGB(255, 201, 198, 198), fontSize: 13.0)),
            SizedBox(
              height: 8.0,
            ),
            Text('王某，48岁。初诊（1965年10月20日）：两肩疼，曾经针灸、拔罐、烤电等均无效。于1965年6月......'),
          ],
        ),
      ),
    );
  }
}

class Disease2 extends StatelessWidget {
  const Disease2({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 380,
      height: 140,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16.0),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color.fromARGB(255, 249, 248, 248), //
              blurRadius: 10.0, // 模糊度
              spreadRadius: 5.0, // 扩散度
              offset: Offset(5.0, 5.0), // 阴影偏移，向右和向下偏移
            )
          ]),
      padding: EdgeInsets.all(16.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Text(
                '脱发',
                style: TextStyle(color: Colors.blue, fontSize: 20.0),
              ),
              SizedBox(
                height: 8.0,
              ),
              Text(
                '医师：赵绍琴',
                style: TextStyle(color: Colors.grey, fontSize: 20.0),
              ),
            ],
          ),
          Text('脱发，头发稀疏，皮屑，脉数，脉弦。',
              style: TextStyle(
                  color: Color.fromARGB(255, 201, 198, 198), fontSize: 13.0)),
          SizedBox(
            height: 8.0,
          ),
          Text(
            '脱发（脂溢性皮炎）陶某某，女，27岁初诊，近半年来，头发明显变细，每日脱发甚多，',
            style: TextStyle(fontSize: 15.0),
          ),
        ],
      ),
    );
  }
}

class Disease3 extends StatelessWidget {
  const Disease3({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 380,
      height: 140,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16.0),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color.fromARGB(255, 249, 248, 248), //
              blurRadius: 10.0, // 模糊度
              spreadRadius: 5.0, // 扩散度
              offset: Offset(5.0, 5.0), // 阴影偏移，向右和向下偏移
            )
          ]),
      padding: EdgeInsets.all(16.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Text(
                '阳痿',
                style: TextStyle(color: Colors.blue, fontSize: 20.0),
              ),
              SizedBox(
                height: 8.0,
              ),
              Text(
                '医师：刘渡舟',
                style: TextStyle(color: Colors.grey, fontSize: 20.0),
              ),
            ],
          ),
          Text('劳倦，阴郁，阳痿，脉弦，舌红。',
              style: TextStyle(
                  color: Color.fromARGB(255, 201, 198, 198), fontSize: 13.0)),
          SizedBox(
            height: 8.0,
          ),
          Text(
            '阳痿案李某，男，32岁。李某之妻探亲而来，一路辛劳，李某却欲当夜求欢，被其妻子拒绝，因而......',
            style: TextStyle(fontSize: 15.0),
          ),
        ],
      ),
    );
  }
}

class Disease4 extends StatelessWidget {
  const Disease4({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 380,
      height: 140,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16.0),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              color: const Color.fromARGB(255, 249, 248, 248), //
              blurRadius: 10.0, // 模糊度
              spreadRadius: 5.0, // 扩散度
              offset: Offset(5.0, 5.0), // 阴影偏移，向右和向下偏移
            )
          ]),
      padding: EdgeInsets.all(16.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Text(
                '牙痛',
                style: TextStyle(color: Colors.blue, fontSize: 20.0),
              ),
              SizedBox(
                height: 8.0,
              ),
              Text(
                '医师：张子和',
                style: TextStyle(color: Colors.grey, fontSize: 20.0),
              ),
            ],
          ),
          Text('齿龈痛，病久，蛀牙',
              style: TextStyle(
                  color: Color.fromARGB(255, 201, 198, 198), fontSize: 13.0)),
          SizedBox(
            height: 8.0,
          ),
          Text(
            '夫风蛀牙疼，久不愈者，用针插巴豆一枚，于灯焰上燎，烟未尽急存性，于牙窝根盘上......',
            style: TextStyle(fontSize: 15.0),
          ),
        ],
      ),
    );
  }
}

class Bar extends StatelessWidget {
  const Bar({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 410,
      height: 90,
      decoration: BoxDecoration(color: Colors.white),
      padding: EdgeInsets.all(16.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.book,
                  size: 35.0,
                  color: Color.fromARGB(255, 208, 190, 137)), // 书案图标
              Text('医案',
                  style: TextStyle(
                      fontSize: 15.0,
                      color: Color.fromARGB(255, 208, 190, 137))),
            ],
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              GestureDetector(
                onTap: () {
                  // 跳转到书城页面
                  Navigator.push(
                    context,
                    MaterialPageRoute(builder: (context) => Bookscreen()),
                  );
                },
                child: Column(
                  children: <Widget>[
                    Icon(Icons.library_books, size: 35.0, color: Colors.grey),
                    Text('书城',
                        style: TextStyle(fontSize: 15.0, color: Colors.grey)),
                  ],
                ),
              ),
            ],
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              GestureDetector(
                onTap: () {
                  // 跳转到我的页面
                  Navigator.push(
                    context,
                    MaterialPageRoute(builder: (context) => Userscreen()),
                  );
                },
                child: Column(
                  children: <Widget>[
                    Icon(Icons.account_circle, size: 35.0, color: Colors.grey),
                    Text('我的',
                        style: TextStyle(fontSize: 15.0, color: Colors.grey)),
                  ],
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
